import uuid

from django.contrib.auth.models import AbstractUser
from django.db import models

# from Apps.System.models.role_menu import Role
from Apps.util.string_util import encode_text


class User(AbstractUser):
    id = models.CharField(max_length=50, primary_key=True, default=uuid.uuid4, help_text="Id", verbose_name="Id")

    # 头像
    name = models.CharField(null=True, blank=True, max_length=30, verbose_name="昵称")
    avatar = models.TextField(null=True, blank=True, verbose_name="自定义头像")
    mobile = models.TextField(default='', verbose_name="电话号码")
    gender = models.BooleanField(default=True, verbose_name="性别")
    remark = models.TextField(verbose_name="备注", null=True)
    create_time = models.DateTimeField(auto_now_add=True)
    update_time = models.DateTimeField(auto_now=True)

    class Meta:
        db_table = "user"
        verbose_name = db_table
        ordering = ('-create_time',)

    def __str__(self):
        return self.name
